import _ from 'lodash'
import {showPublicUrl} from 'libs/utils.js'

export function List(ctx) {
  var list = [{
    field: 'name',
    width: 'auto'
  }, {
    field: 'topoId',
    width: 'auto'
  },{
    field: 'portName',
    width: 'auto'
  }, {
    field: 'srcType',
    width: 'auto'
  }, {
    field: 'mainUrl',
    width: '20%',
    show: function(item) {
      return showPublicUrl(item.mainUrl)
    }
  }, {
    field: 'previewUrl',
    width: '20%',
    show: function(item) {
      return showPublicUrl(item.previewUrl)
    }
  }]

  _.forEach(list, (item) => {
    let keypath = 'list.' + item.field
    item.name = ctx.$t(keypath)
  })

  return list 
}